package com.woniuxy.enjoylife.utils;

import java.util.Random;

/**
 * 验证码生成工具类
 */
public class CodeCreate {

    /**
     * 生成验证码
     * @param index 需要生成验证码的位数
     * @return 验证码
     */
    public static final String createCode(int index){
        Random random = new Random();
        int num = (int) Math.pow(10,index-1);
        int codes = random.nextInt(9*num)+1*num;
        return String.valueOf(codes);
    }
}
